<?php

namespace app\admin\controller;

use think\Db;
use think\Request;

class AdvertNodes
{
    /***加载首页
     * @return \think\response\View
     * @throws \think\exception\DbException
     */
    public function index()
    {
        $nodes = Db::table('advertisement_nodes')->paginate(4);
//        return $nodes;
        return view('AdvertNodes/index', compact('nodes'));
    }

    public function create()
    {

        return view('AdvertNodes/create');
    }

    public function save(Request $request)
    {
        $data = $request->param();
        $data['create_time'] = date('Y-m-d H:i:s', time());
        $data['update_time'] = date('Y-m-d H:i:s', time());
        Db::table('advertisement_nodes')->insert($data);
        return redirect('AdvertNodes/index');
    }
}